<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:wpf="clr-namespace:MaterialDesignThemes.Wpf;assembly=MaterialDesignThemes.Wpf"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:dentalConverters="clr-namespace:DentalConfig.Converters;assembly=DentalConfig">
  <ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="../Brushes/MaterialDesign/MaterialDesignTheme.Theme.xaml"/>
    <ResourceDictionary Source="../NamedStyles/MaterialDesignTheme.NamedTextBlock.xaml"/>
    <ResourceDictionary Source="MaterialDesignTheme.ValidationErrorTemplate.xaml" />
  </ResourceDictionary.MergedDictionaries>

  <dentalConverters:BrushToTransmittantBrushConverter x:Key="BrushToTransmittantBrushConverter"/>

  <Style x:Key="OptionMarkFocusVisual">
    <Setter Property="Control.Template">
      <Setter.Value>
        <ControlTemplate>
          <Rectangle Margin="0,0,0,0" SnapsToDevicePixels="true" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeThickness="1" StrokeDashArray="1 2"/>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="FocusVisual">
    <Setter Property="Control.Template">
      <Setter.Value>
        <ControlTemplate>
          <Rectangle Margin="2" SnapsToDevicePixels="true" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeThickness="1" StrokeDashArray="1 2"/>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="EllipseFocusVisual">
    <Setter Property="Control.Template">
      <Setter.Value>
        <ControlTemplate>
          <Grid>
            <Canvas>
              <Ellipse Fill="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Foreground}" Width="25" Height="25" Canvas.Left="-3" Canvas.Top="-3" Opacity="0.12"/>
            </Canvas>
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="OverlayFocusVisual">
    <Setter Property="Control.Template">
      <Setter.Value>
        <ControlTemplate>
          <Border CornerRadius="2" Background="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Foreground, Converter={StaticResource BrushToTransmittantBrushConverter}, ConverterParameter=0.12}"/>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="MaterialDesignRadioButton" TargetType="{x:Type RadioButton}">
    <Setter Property="FocusVisualStyle" Value="{StaticResource EllipseFocusVisual}"/>
    <Setter Property="BorderThickness" Value="1"/>
    <Setter Property="Foreground" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type FrameworkElement}}, Path=(TextElement.Foreground)}"/>
    <Setter Property="Background" Value="{DynamicResource MidContrastPrimaryBrush}"/>
    <Setter Property="BorderBrush" Value="{DynamicResource MidContrastPrimaryBrush}"/>
    <Setter Property="Validation.ErrorTemplate" Value="{StaticResource MaterialDesignValidationErrorTemplate}"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type RadioButton}">
          <ControlTemplate.Resources>
            <Storyboard x:Key="Click">
              <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Width)" Storyboard.TargetName="InteractionEllipse">
                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="48"/>
              </DoubleAnimationUsingKeyFrames>
              <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Height)" Storyboard.TargetName="InteractionEllipse">
                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="48"/>
              </DoubleAnimationUsingKeyFrames>
              <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="InteractionEllipse">
                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="-24"/>
              </DoubleAnimationUsingKeyFrames>
              <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)" Storyboard.TargetName="InteractionEllipse">
                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="-24"/>
              </DoubleAnimationUsingKeyFrames>
              <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="InteractionEllipse">
                <EasingDoubleKeyFrame KeyTime="0" Value="0.3"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="0"/>
              </DoubleAnimationUsingKeyFrames>
            </Storyboard>
          </ControlTemplate.Resources>
          <Grid x:Name="templateRoot" Background="Transparent" SnapsToDevicePixels="True">
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="Auto"/>
              <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Viewbox Width="18" Height="18"  VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
              <Canvas Width="24" Height="24">
                <Path x:Name="Graphic"
                      Data="M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z"
                      Fill="{TemplateBinding Foreground}"
                      Opacity="0.53"/>
                <Ellipse x:Name="InteractionEllipse" Fill="{TemplateBinding Foreground}" Width="0" Height="0" Canvas.Top="12" Canvas.Left="12" Opacity="0" RenderTransformOrigin="0.5,0.5" >
                  <Ellipse.RenderTransform>
                    <TransformGroup>
                      <ScaleTransform/>
                      <SkewTransform/>
                      <RotateTransform/>
                      <TranslateTransform/>
                    </TransformGroup>
                  </Ellipse.RenderTransform>
                </Ellipse>
              </Canvas>
            </Viewbox>
            <ContentPresenter x:Name="contentPresenter" Grid.Column="1" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="False" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
              <ContentPresenter.Resources>
                <Style x:Key="{x:Type TextBlock}" BasedOn="{StaticResource ControlContentTextblock}" TargetType="{x:Type TextBlock}"/>
              </ContentPresenter.Resources>
            </ContentPresenter>
          </Grid>
          <ControlTemplate.Triggers>
            <EventTrigger RoutedEvent="ButtonBase.Click">
              <BeginStoryboard Storyboard="{StaticResource Click}"/>
            </EventTrigger>
            <Trigger Property="HasContent" Value="true">
              <!--<Setter Property="FocusVisualStyle" Value="{StaticResource OptionMarkFocusVisual}"/>-->
              <Setter Property="Padding" Value="4,2,0,0"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="false">
              <Setter Property="Opacity" Value="{StaticResource DisabledOpacity}"/>
            </Trigger>
            <Trigger Property="IsPressed" Value="true"/>
            <Trigger Property="IsChecked" Value="true">
              <Setter Property="Data" TargetName="Graphic" Value="M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,7A5,5 0 0,0 7,12A5,5 0 0,0 12,17A5,5 0 0,0 17,12A5,5 0 0,0 12,7Z" />
              <Setter Property="Fill" TargetName="Graphic" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Background}" />
              <Setter Property="Opacity" TargetName="Graphic" Value="1" />
            </Trigger>
            <Trigger Property="IsChecked" Value="{x:Null}">
              <Setter Property="Data" TargetName="Graphic" Value="M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,7A5,5 0 0,0 7,12A5,5 0 0,0 12,17A5,5 0 0,0 17,12A5,5 0 0,0 12,7Z" />
              <Setter Property="Opacity" TargetName="Graphic" Value="0.56"/>
            </Trigger>
            <Trigger Property="Validation.HasError" Value="true">
              <Setter Property="Fill" TargetName="Graphic" Value="{DynamicResource ValidationErrorBrush}"/>
              <Setter Property="Control.Foreground" TargetName="contentPresenter" Value="{DynamicResource ValidationErrorBrush}"/>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="MaterialDesignLightRadioButton" TargetType="{x:Type RadioButton}" BasedOn="{StaticResource MaterialDesignRadioButton}">
    <Setter Property="Background" Value="{DynamicResource PrimaryHueLightBrush}"/>
    <Setter Property="BorderBrush" Value="{DynamicResource PrimaryHueLightBrush}"/>
  </Style>

  <Style x:Key="MaterialDesignDarkRadioButton" TargetType="{x:Type RadioButton}" BasedOn="{StaticResource MaterialDesignRadioButton}">
    <Setter Property="Background" Value="{DynamicResource PrimaryHueDarkBrush}"/>
    <Setter Property="BorderBrush" Value="{DynamicResource PrimaryHueDarkBrush}"/>
  </Style>

  <Style x:Key="MaterialDesignAccentRadioButton" TargetType="{x:Type RadioButton}" BasedOn="{StaticResource MaterialDesignRadioButton}">
    <Setter Property="Background" Value="{DynamicResource SecondaryAccentBrush}"/>
    <Setter Property="BorderBrush" Value="{DynamicResource SecondaryAccentBrush}"/>
  </Style>

  <Style x:Key="MaterialDesignUserForegroundRadioButton" TargetType="{x:Type RadioButton}">
    <Style.Resources>
      <Style x:Key="{x:Type TextBlock}" BasedOn="{StaticResource ControlContentTextblock}" TargetType="{x:Type TextBlock}"/>
    </Style.Resources>
    <Setter Property="FocusVisualStyle" Value="{StaticResource EllipseFocusVisual}"/>
    <Setter Property="BorderThickness" Value="1"/>
    <Setter Property="Foreground" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type FrameworkElement}}, Path=(TextElement.Foreground)}"/>
    <Setter Property="Validation.ErrorTemplate" Value="{StaticResource MaterialDesignValidationErrorTemplate}"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type RadioButton}">
          <ControlTemplate.Resources>
            <Storyboard x:Key="Click">
              <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Width)" Storyboard.TargetName="InteractionEllipse">
                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="48"/>
              </DoubleAnimationUsingKeyFrames>
              <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Height)" Storyboard.TargetName="InteractionEllipse">
                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="48"/>
              </DoubleAnimationUsingKeyFrames>
              <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="InteractionEllipse">
                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="-24"/>
              </DoubleAnimationUsingKeyFrames>
              <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)" Storyboard.TargetName="InteractionEllipse">
                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="-24"/>
              </DoubleAnimationUsingKeyFrames>
              <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="InteractionEllipse">
                <EasingDoubleKeyFrame KeyTime="0" Value="0.3"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="0"/>
              </DoubleAnimationUsingKeyFrames>
            </Storyboard>
          </ControlTemplate.Resources>
          <Grid x:Name="templateRoot" Background="Transparent" SnapsToDevicePixels="True">
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="Auto"/>
              <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Viewbox Width="18" Height="18"  VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
              <Canvas Width="24" Height="24">
                <Path x:Name="Graphic"
                      Data="M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z"
                      Fill="{TemplateBinding Foreground}" />
                <Ellipse x:Name="InteractionEllipse" Fill="{TemplateBinding Foreground}" Width="0" Height="0" Canvas.Top="12" Canvas.Left="12" Opacity="0" RenderTransformOrigin="0.5,0.5" >
                  <Ellipse.RenderTransform>
                    <TransformGroup>
                      <ScaleTransform/>
                      <SkewTransform/>
                      <RotateTransform/>
                      <TranslateTransform/>
                    </TransformGroup>
                  </Ellipse.RenderTransform>
                </Ellipse>
              </Canvas>
            </Viewbox>
            <ContentPresenter x:Name="contentPresenter" Grid.Column="1" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="False" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
          </Grid>
          <ControlTemplate.Triggers>
            <EventTrigger RoutedEvent="ButtonBase.Click">
              <BeginStoryboard Storyboard="{StaticResource Click}"/>
            </EventTrigger>
            <Trigger Property="HasContent" Value="true">
              <!--<Setter Property="FocusVisualStyle" Value="{StaticResource OptionMarkFocusVisual}"/>-->
              <Setter Property="Padding" Value="4,2,0,0"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="false">
              <Setter Property="Opacity" Value="{StaticResource DisabledOpacity}"/>
            </Trigger>
            <Trigger Property="IsPressed" Value="true"/>
            <Trigger Property="IsChecked" Value="true">
              <Setter Property="Data" TargetName="Graphic" Value="M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,7A5,5 0 0,0 7,12A5,5 0 0,0 12,17A5,5 0 0,0 17,12A5,5 0 0,0 12,7Z" />
            </Trigger>
            <Trigger Property="IsChecked" Value="{x:Null}">
              <Setter Property="Data" TargetName="Graphic" Value="M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,7A5,5 0 0,0 7,12A5,5 0 0,0 12,17A5,5 0 0,0 17,12A5,5 0 0,0 12,7Z" />
              <Setter Property="Opacity" TargetName="Graphic" Value="0.56"/>
            </Trigger>
            <Trigger Property="Validation.HasError" Value="true">
              <Setter Property="Fill" TargetName="Graphic" Value="{DynamicResource ValidationErrorBrush}"/>
              <Setter Property="Control.Foreground" TargetName="contentPresenter" Value="{DynamicResource ValidationErrorBrush}"/>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="MaterialDesignTabRadioButton"  TargetType="{x:Type RadioButton}">
    <Style.Resources>
      <Style x:Key="{x:Type TextBlock}" BasedOn="{StaticResource ControlContentTextblock}" TargetType="{x:Type TextBlock}"/>
    </Style.Resources>
    <Setter Property="FocusVisualStyle" Value="{StaticResource OverlayFocusVisual}"/>
    <Setter Property="Foreground" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type FrameworkElement}}, Path=(TextElement.Foreground)}"/>
    <Setter Property="Background" Value="Transparent"/>
    <Setter Property="BorderBrush" Value="{DynamicResource SecondaryAccentBrush}"/>
    <Setter Property="Padding" Value="16 4 16 4"/>
    <Setter Property="Height" Value="32" />
    <Setter Property="MinWidth" Value="80" />
    <Setter Property="wpf:RippleAssist.Feedback" Value="{DynamicResource MaterialDesignFlatButtonRipple}" />
    <Setter Property="TextBlock.FontWeight" Value="Medium"/>
    <Setter Property="TextBlock.FontSize" Value="14"/>
    <Setter Property="HorizontalContentAlignment" Value="Center"/>
    <Setter Property="VerticalContentAlignment" Value="Center"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type RadioButton}">
          <Grid SnapsToDevicePixels="true">
            <Grid.RowDefinitions>
              <RowDefinition Height="*" />
              <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Border Background="{TemplateBinding Background}">
              <wpf:Ripple Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" Focusable="False"
                          HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                          VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                          RecognizesAccessKey="False"
                          Padding="{TemplateBinding Padding}"
                          x:Name="contentPresenter"
                          Opacity=".82"
                          SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
            </Border>
            <Border x:Name="SelectionHighlightBorder" Background="{TemplateBinding BorderBrush}" Height="4" Grid.Row="1" RenderTransformOrigin="0.5,1">
              <Border.RenderTransform>
                <TransformGroup>
                  <ScaleTransform x:Name="ScaleTransform" ScaleX="0" ScaleY="1" />
                </TransformGroup>
              </Border.RenderTransform>
            </Border>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="IsChecked" Value="True">
              <Setter TargetName="contentPresenter" Property="Opacity" Value="1"/>
              <Trigger.EnterActions>
                  <BeginStoryboard>
                      <Storyboard>
                        <DoubleAnimation Storyboard.TargetProperty="ScaleX" Storyboard.TargetName="ScaleTransform" From="0" To="1" Duration="0:0:0.3">
                          <DoubleAnimation.EasingFunction>
                            <SineEase EasingMode="EaseOut" />
                          </DoubleAnimation.EasingFunction>
                        </DoubleAnimation>
                      </Storyboard>
                  </BeginStoryboard>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                  <BeginStoryboard>
                      <Storyboard>
                          <Storyboard>
                            <DoubleAnimation Storyboard.TargetProperty="ScaleX" Storyboard.TargetName="ScaleTransform" From="1" To="0" Duration="0:0:0.3">
                              <DoubleAnimation.EasingFunction>
                                <SineEase EasingMode="EaseOut" />
                              </DoubleAnimation.EasingFunction>
                            </DoubleAnimation>
                          </Storyboard>
                      </Storyboard>
                  </BeginStoryboard>
              </Trigger.ExitActions>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="MaterialDesignFlatTabRadioButton"  TargetType="{x:Type RadioButton}">
    <Style.Resources>
      <Style x:Key="{x:Type TextBlock}" BasedOn="{StaticResource ControlContentTextblock}" TargetType="{x:Type TextBlock}"/>
    </Style.Resources>
    <Setter Property="FocusVisualStyle" Value="{StaticResource OverlayFocusVisual}"/>
    <Setter Property="Foreground" Value="{DynamicResource MidContrastPrimaryBrush}"/>
    <Setter Property="Background" Value="{DynamicResource MaterialDesignFlatButtonClick}"/>
    <Setter Property="BorderBrush" Value="{DynamicResource SecondaryAccentBrush}"/>
    <Setter Property="Padding" Value="16 4 16 4"/>
    <Setter Property="Height" Value="32" />
    <Setter Property="MinWidth" Value="80" />
    <Setter Property="wpf:RippleAssist.Feedback" Value="{DynamicResource MaterialDesignFlatButtonRipple}" />
    <Setter Property="TextBlock.FontWeight" Value="Medium"/>
    <Setter Property="TextBlock.FontSize" Value="14"/>
    <Setter Property="HorizontalContentAlignment" Value="Center"/>
    <Setter Property="VerticalContentAlignment" Value="Center"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type RadioButton}">
          <Grid SnapsToDevicePixels="true">
            <Grid.RowDefinitions>
              <RowDefinition Height="*" />
              <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <ContentPresenter
              x:Name="contentPresenter"
              HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
              VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
              Margin="{TemplateBinding Padding}"
              SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
              <ContentPresenter.RenderTransform>
                <TranslateTransform X="60000" Y="60000" /> <!-- We use the content presenter as mask, render it offscreen -->
              </ContentPresenter.RenderTransform>
            </ContentPresenter>
            <Border Background="Transparent" x:Name="border" CornerRadius="2" BorderBrush="Transparent"/>
            <Rectangle x:Name="rectangle" Fill="{TemplateBinding Foreground}" Width="{Binding ElementName=contentPresenter, Path=ActualWidth}" Height="{Binding ElementName=contentPresenter, Path=ActualHeight}">
              <Rectangle.OpacityMask>
                <VisualBrush TileMode="None" Stretch="None" Visual="{Binding ElementName=contentPresenter}"/>
              </Rectangle.OpacityMask>
            </Rectangle>
            <wpf:Ripple Focusable="False"
                        HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                        VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                        RecognizesAccessKey="False"
                        Padding="{TemplateBinding Padding}"
                        Opacity=".82"
                        SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
            <Border x:Name="SelectionHighlightBorder" Background="{TemplateBinding BorderBrush}" Height="4" Grid.Row="1" RenderTransformOrigin="0.5,1">
              <Border.RenderTransform>
                <TransformGroup>
                  <ScaleTransform x:Name="ScaleTransform" ScaleX="0" ScaleY="1" />
                </TransformGroup>
              </Border.RenderTransform>
            </Border>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="true">
              <Setter Property="BorderBrush" TargetName="border" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=BorderBrush}"/>
              <Setter Property="Background" TargetName="border" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Background}"/>
            </Trigger>
            <Trigger Property="IsChecked" Value="True">
              <Setter Property="Foreground" Value="{DynamicResource SecondaryAccentBrush}"/>
              <Trigger.EnterActions>
                  <BeginStoryboard>
                      <Storyboard>
                        <DoubleAnimation Storyboard.TargetProperty="ScaleX" Storyboard.TargetName="ScaleTransform" From="0" To="1" Duration="0:0:0.3">
                          <DoubleAnimation.EasingFunction>
                            <SineEase EasingMode="EaseOut" />
                          </DoubleAnimation.EasingFunction>
                        </DoubleAnimation>
                      </Storyboard>
                  </BeginStoryboard>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                  <BeginStoryboard>
                      <Storyboard>
                          <Storyboard>
                            <DoubleAnimation Storyboard.TargetProperty="ScaleX" Storyboard.TargetName="ScaleTransform" From="1" To="0" Duration="0:0:0.3">
                              <DoubleAnimation.EasingFunction>
                                <SineEase EasingMode="EaseOut" />
                              </DoubleAnimation.EasingFunction>
                            </DoubleAnimation>
                          </Storyboard>
                      </Storyboard>
                  </BeginStoryboard>
              </Trigger.ExitActions>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="{x:Type RadioButton}" BasedOn="{StaticResource MaterialDesignRadioButton}" TargetType="{x:Type RadioButton}" />

</ResourceDictionary>
